package com.创建型模式.单例模式.懒总统;

import java.awt.*;

public class LazyBoss {
    public static volatile LazyBoss boss = null;
    private LazyBoss(){

    }
    public static synchronized LazyBoss getBoss(){
        if (boss == null){
            System.out.println("总统诞生");
            boss = new LazyBoss();
        }else{
            System.out.println("总统已经有了，你娃娃要造反吗");
        }
        return boss;
    }
    public void getName(){
        System.out.println("我是总统大王，孙中山");
    }
}
